<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
    <head>
        <title>品牌列表信息</title>
    </head>
    <body>
        <a href="brand_add.jsp">添加品牌信息</a>
        <table border="1" cellspacing="0" width="1200px">
            <tr>
                <th>序号</th>
                <th>品牌名称</th>
                <th>企业名称</th>
                <th>排序</th>
                <th>品牌介绍</th>
                <th>状态</th>
                <th>操作</th>
            </tr>

            <c:if test="${not empty brands}">
                <c:forEach items="${brands}" var="brand">
                    <tr align="center">
                        <td>${brand.id}</td>
                        <td>${brand.brandName}</td>
                        <td>${brand.companyName}</td>
                        <td>${brand.ordered}</td>
                        <td>${brand.description}</td>
                        <c:if test="${brand.status==1}">
                            <td>启用</td>
                        </c:if>
                        <c:if test="${brand.status ==0}">
                            <td>禁用</td>
                        </c:if>
                        <td><a href="/day28_brand/BrandServlet?action=findById&id=${brand.id}">修改</a>
                            <a href="javascript:void(0);" onclick="deleteById(${brand.id})">删除</a>
                        </td>
                    </tr>
                </c:forEach>
            </c:if>

        </table>


        <script>

            function deleteById(id) {
                // alert(id);
                // 删除确认
                if(confirm("您确定要删除该记录么？")){
                    // 执行服务器端的Servlet
                    location.href="/day28_brand/BrandServlet?action=deleteById&id="+id;
                }
            }


        </script>
    </body>
</html>
